<?php
/**
 * 查询控制器
 */
namespace app\manage\controller\apply;

use app\manage\controller\Base;
use app\common\query\MemberCoinBankApply;
use app\common\query\MemberApply;

class Api extends Base
{

    public function member_apply(){
        $params = $this->request->param();
        
        $perpagenum = isset($params['limit'])?intval($params['limit']):15;
        $perpagenum = $perpagenum>100?100:$perpagenum;
        $page = isset($params['page'])?intval($params['page']):1;
        $page = $page<1?1:$page;

        unset($params['limit']);
        unset($params['page']);
        $where = [];
        if(isset($params['key'])){
            $where= parseWhere($params['key']);
        }
        $where['status'] = 0;

        $data = model('member_apply')->getPageDatas($where,$page,$perpagenum);
        $data['code'] = 1;
        return json($data);
    }

    public function charge_apply(){
        $params = $this->request->param();
        
        $perpagenum = isset($params['limit'])?intval($params['limit']):15;
        $perpagenum = $perpagenum>100?100:$perpagenum;
        $page = isset($params['page'])?intval($params['page']):1;
        $page = $page<1?1:$page;

        unset($params['limit']);
        unset($params['page']);
        $where['status'] = 0;
        if(isset($params['key'])){
            $where= parseWhere($params['key']);
        }

        $data = model('operate_charge')->getPageDatas($where,$page,$perpagenum);
        $data['code'] = 1;
        return json($data);
    }

    public function withdraw_apply(){
        $params = $this->request->param();
        
        $perpagenum = isset($params['limit'])?intval($params['limit']):15;
        $perpagenum = $perpagenum>100?100:$perpagenum;
        $page = isset($params['page'])?intval($params['page']):1;
        $page = $page<1?1:$page;

        unset($params['limit']);
        unset($params['page']);
        $where['status'] = 0;
        if(isset($params['key'])){
            $where= parseWhere($params['key']);
        }

        $data = model('operate_withdraw')->getPageDatas($where,$page,$perpagenum);
        $data['code'] = 1;
        return json($data);
    }





	// /**
 //     * 报单中心申请记录接口
 //     * @return [type] [description]
 //     */
 //    public function member_apply(){
 //    	$params = $this->request->param();
 //        if(!isset($params['status'])){
 //            $params['status'] = 0;
 //        }
 //        $where = $params;
 //        $query = new MemberApply;
 //        $data = $query -> getDatas($where);

 //        return json($data);
 //    }

 //    /**
 //     * 会员充值、提现申请接口
 //     * @return [type] [description]
 //     */
 //    public function charge_apply(){
 //        $params = $this->request->param();

 //        $where = $params;
 //        $where['status'] = 0;
 //        unset($where['page']);
 //        $queryStr = '&'.parseQuery($where);

 //        $query = new \app\common\query\OperateCharge;
 //        $data = $query -> getRows($where,$queryStr,url('apply.show/charge'));
 //        return json($data);

 //    }

 //    public function withdraw_apply(){
 //        $params = $this->request->param();

 //        $where = $params;
 //        $where['status'] = 0;
 //        unset($where['page']);
 //        $queryStr = '&'.parseQuery($where);

 //        $query = new \app\common\query\OperateWithdraw;
 //        $data = $query -> getRows($where,$queryStr,url('apply.show/withdraw'));
 //        return json($data);

 //    }

}